package com.itheima.stock.controller;

import com.itheima.stock.common.domian.*;
import com.itheima.stock.service.Stock_rtIndexInfoService;
import com.itheima.stock.vo.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author: siwukun
 * @date: 2022/06/02
 * @description: 股票成交量对比
 */
@RestController
@RequestMapping("/api/quot/stock")
public class Stock_rtIndexInfoController {

    @Autowired
    private Stock_rtIndexInfoService service;

    /**
     * 股票成交量对比
     *
     * @return
     */
    @GetMapping("/tradevol")
    public R<Map<String, List>> selectAllMarketInfoUpDown() {
        return service.queryAllMarketInfoUpDown();
    }


    /**
     * 个股分时涨跌幅度统计
     *
     * @return
     */
    @GetMapping("/updown")
    public R<Map> selectAllStockGain() {
        return service.queryAllStockGain();
    }

    /**
     * 查询个股的分时行情数据
     *
     * @param code 股票代码
     * @return List
     */
    @GetMapping("/screen/time-sharing")
    public R<List<Stock4MinuteDomain>> selectStockTimeSharing(@RequestParam("code") String code) {

        return service.qureyStockTimeSharing(code);
    }


    /**
     * 日k线
     *
     * @param code
     * @return
     */
    @GetMapping("/screen/dkline")
    public R<List<Stock4MinuteDomain>> selectDayKLine(@RequestParam("code") String code) {

        return service.queryDayKLine(code);
    }

    /**
     * 查询所有的股票代码
     *
     * @return
     */
    @GetMapping("/search")
    public R<List> getAllACode(@RequestParam String searchStr) {
        return service.queryAllACode(searchStr);
    }

    /**
     * 个股主营业务查询接口
     *
     * @param code code码
     * @return List
     */
    @GetMapping("/describe")
    public R<StockBusiness> getMainBusinessOfIndividualStocks(@RequestParam String code) {

        return service.queryMainBusinessOfIndividualStocks(code);
    }


    /**
     * 周k线
     *
     * @param code code码
     * @return
     */
    @GetMapping("/screen/weekkline")
    public R<List<StockWeekLineDomain>> selectWeekKLine(@RequestParam("code") String code) {

        return service.queryWeeKLine(code);
    }

    /**
     * 个股最新分时行情数据
     *
     * @param code code码
     * @return
     */
    @GetMapping("/screen/second/detail")
    public R<StockRtIndexInfoDomain> getAllTheLatestTimeSharingQuotationOfIndividualStocks(@RequestParam("code") String code) {
        return service.queryTheLatestTimeSharingQuotationOfIndividualStocks(code);
    }


    /**
     * 个股实时交易流水查询
     *
     * @param code
     * @return
     */
    @GetMapping("/screen/second")
    public R<List<StockFlowDomain>> getGStockFlow(@RequestParam("code") String code) {
        return service.queryGStockFlow(code);
    }
}

